﻿using System;

namespace CommLib
{
    public enum CallLogType
    {
        Incoming, Outgoing, Missed, Unknown
    }

    public class CallLogEntry
    {
        public readonly static int FIELD_COUNT = 4;

        private readonly string mName;
	    private readonly string mNumber;
	    private readonly DateTime mDate;
        private readonly long mDuration;

        public CallLogEntry(String[] data, int firstIdx) 
        {
		    if (data.Length - firstIdx < FIELD_COUNT)
			    throw new ArgumentException("Too few data fields!");

		    mName = data[firstIdx++];
            mNumber = data[firstIdx++];
            mDate = BluetoothMessage.parseDateTime(long.Parse(data[firstIdx++]));
            mDuration = long.Parse(data[firstIdx++]);
	    }

        public string getName()
        {
            return mName;
        }

        public string getNumber()
        {
            return mNumber;
        }

        public DateTime getDate()
        {
            return mDate;
        }

        public long getDuration()
        {
            return mDuration;
        }
    }
}
